package com.offdissys.common.core.exception;

import com.offdissys.common.core.constant.ResultEnumInterface;

/**
 * @ClassName CommException
 * @Description 自定义异常类
 * @Author zhanghaiwen
 * @Date 2020/1/9 15:13
 * @Version 6.1.1
 **/
public class CommException extends RuntimeException  {

    /**
     * 异常信息
     */
    private String errorMsg;

    /**
     * 错误码
     */
    private Integer code;

    /**
     * 请求参数
     */
    private Object[] args;


    public CommException(ResultEnumInterface resultEnumInterface) {
        super(resultEnumInterface.getMsg());
        this.code = resultEnumInterface.getCode();
        this.errorMsg = resultEnumInterface.getMsg();
    }

    public CommException(ResultEnumInterface resultEnumInterface, Object[] args) {
        super(resultEnumInterface.getMsg());
        this.code = resultEnumInterface.getCode();
        this.errorMsg = resultEnumInterface.getMsg();
        this.args = args;
    }

    public CommException(Integer code , String errorMsg) {
        super(errorMsg);
        this.code = code;
        this.errorMsg = errorMsg;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Object[] getArgs() {
        return args;
    }

    public void setArgs(Object[] args) {
        this.args = args;
    }
}
